home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 June / PCpro_2006_06.ISO / files / freeware / openvip.exe / {app} / ObjectPanel.py < prev    next >
Encoding:
Python Source  |  2003-06-09  |  2.8 KB  |  84 lines

  1. #
  2. # This file is part of OpenVIP (http://openvip.sourceforge.net)
  3. #
  4. # Copyright (C) 2002-2003
  5. # Michal Dvorak, Jiri Sedlar, Antonin Slavik, Vaclav Slavik, Jozef Smizansky
  6. #
  7. # This program is licensed under GNU General Public License version 2;
  8. # see file COPYING in the top level directory for details.
  9. #
  10. # $Id: ObjectPanel.py,v 1.20 2003/06/09 09:08:47 vaclavslavik Exp $
  11. #
  12.  
  13. from wxPython.wx import *
  14. from FilterPanel import FilterPanel
  15. from TransitionPanel import TransitionPanel
  16. import model
  17.  
  18. class ObjectPanel(wxPanel):
  19.     """ObjectPanel is the panel with details about object selected on timeline.
  20.        It is on the right side of OpenVIP GUI's main frame. This class is
  21.        container class that can hold either FilterPanel or TransitionPanel
  22.        inside, depending on current selection.
  23.        """
  24.     def __init__(self, *args, **kwds):
  25.         # begin wxGlade: ObjectPanel.__init__
  26.         wxPanel.__init__(self, *args, **kwds)
  27.         self.panel = wxPanel(self, -1)
  28.  
  29.         self.__set_properties()
  30.         self.__do_layout()
  31.         # end wxGlade
  32.         self.filterpanel = FilterPanel(self, -1)
  33.         self.transpanel = TransitionPanel(self, -1)
  34.         self.nopanel = wxPanel(self, -1)
  35.         self.filterpanel.Show(0)
  36.         self.transpanel.Show(0)
  37.         self.nopanel.Show(0)
  38.  
  39.     def __set_properties(self):
  40.         # begin wxGlade: ObjectPanel.__set_properties
  41.         pass
  42.         # end wxGlade
  43.  
  44.     def __do_layout(self):
  45.         # begin wxGlade: ObjectPanel.__do_layout
  46.         sizer_5 = wxBoxSizer(wxHORIZONTAL)
  47.         sizer_5.Add(self.panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0)
  48.         self.SetAutoLayout(1)
  49.         self.SetSizer(sizer_5)
  50.         sizer_5.Fit(self)
  51.         sizer_5.SetSizeHints(self)
  52.         self.Layout()
  53.         # end wxGlade
  54.  
  55.     def SetObject(self, modl, obj):
  56.         """Called when selection changes to display appropriate panel.
  57.            Depending on what type 'obj' is, creates either FilterPanel or
  58.            TransitionPanel subpanel."""
  59. #        self.panel.Destroy()
  60.         if isinstance(obj,model.Object):
  61.             if not isinstance(self.panel,FilterPanel):
  62.                 self.panel.Show(0)
  63.                 self.panel = self.filterpanel
  64.                 self.panel.Show(1)
  65.             self.panel.SetObject(modl, obj)
  66.         elif isinstance(obj,model.Transition):
  67.             if not isinstance(self.panel,TransitionPanel):
  68.                 self.panel.Show(0)
  69.                 self.panel = self.transpanel
  70.                 self.panel.Show(1)
  71.             self.panel.SetObject(modl, obj)
  72.         else:
  73.             self.panel.Show(0)
  74.             self.panel = self.nopanel
  75.             self.panel.Show(1)
  76.         self.panel.Layout()
  77.         self.__do_layout()
  78.         # an ugly hack to force correct size of window embedded in splitter:
  79.         self.GetParent().ReplaceWindow(self, self)
  80.  
  81. # end of class ObjectPanel
  82.  
  83.  
  84.